<!DOCTYPE html>
<html>
<head>
<style>
	* { font:12px Consolas; }
	button, textarea { width:700px; }
</style>
<script>
	function $(id) { return document.getElementById(id); }
	function getOnclick(index) {
		$("d" + index).value = $("cont" + index).innerHTML;
	}
	window.onload = function () {
		var b1 = $("b1");
		var b2 = $("b2");
		var cont1 = $("cont1");
		var cont2 = $("cont2");
		var s1 = $("s1");
		var s2 = $("s2");
		var funcStr1 = "$('s1').innerHTML='set string<br>get '+typeof this.getAttribute('onmouseover')";
		var funcStr2 = "$('s2').innerHTML='set function<br>get '+typeof this.getAttribute('onmouseover')";
		b1.setAttribute("onclick", funcStr1);
		b2.setAttribute("onclick", new Function(funcStr2));
		b1.click();
		b2.click();
	}
</script>
</head>
<body>
	<div id="cont1"><button id="b1" type="button" onmouseover="">funcStr1</button></div><span id="s1">N/A</span><br />
	<br /><br />
	<div id="cont2"><button id="b2" type="button" onmouseover="">new Function(funcStr2)</button></div><span id="s2">N/A</span><br />
</body>
</html>